Skip to content

Conversation

@TomekFraczek
Copy link
Collaborator

@TomekFraczek TomekFraczek commented May 17, 2019

Optional pull request/up for discussion

To simplify the build process and make the application more operating system agnostic, I've wrapped the install in a docker container, built out of a series of dockerfiles.

Primarily, this allows the code to work in the exact same way on every machine, and to be isolated in it's own, safe environment. Additionally, the build/install process on new machines will be reduced to a one-liner (not counting network configurations), and can be easily extended to include a stable production version (related to #26).

For development purposes, the build process was split into several stages: base, python and code.

  • base: build the os-level dependencies and directory strcture
  • python: build the python dependencies, set up python variables
  • code: build source-code based dependencies, run configuration and database setup

This allows the docker image to be rebuilt at any of the three levels, so as few as possible of the installs are repeated. Together with dockerfile caching, this allows for very quick build times.

Other related upgrades:

  • Optimize ubuntu packages, remove redundacies
  • Updated rabbit-mq install process (repository moved, settings updated)
  • Use requirements.txt file in install proceess
  • Move more packages to pip install (i.e. scipy, numpy)
  • Update of django database setup (as per Upgrade django library #21)
    Now uses makemigrations and migrate instead of syncdb
  • Automatically fix bash scripts broken by editing in windows (remove /r line endings)
  • Fully automatic install process with (settable) default values, config available at any later time.
    On Linux, use : ./config.sh <image_name>. On windows use: config.bat <image_name>

TODO

As of right now, the install is incomplete, as it is still missing some packages. Packages to still be added:

  • OpenGL-accelerate
  • plexon
  • Phigets

Testing and Setup

  • Clean up imports
  • Verify and auto-setup connectivity

What do you think? Is this a valuable way to go?

Dockerfile to prepare for installation
Clone of install script dedicated to docker installation
  - Remove sudo
  - Remove git pull of tasks and analysis
  - Update rabbitmq repo
  - Remove redundant apt-get calls
  - Install all pip dependencies through requirements file
  - Fix task symlinks (must run from parent dir)
  - Fix all bash scripts with windows line endings
  - Save env vars (BMI3D path and python path) for future use
  - Add default entrypoint to run server
  - Fix config file path

Signed-off-by: Tomek Fraczek <tfraczek@uw.edu>
Updating local to reflect remote changes
@TomekFraczek TomekFraczek requested review from pkhanna104 and sgowda May 17, 2019 23:46
@TomekFraczek TomekFraczek changed the title Docker build [WIP] Docker build May 17, 2019
@TomekFraczek TomekFraczek mentioned this pull request May 17, 2019
USER=root # We're in a docker container so root is safe

####### Download any src code
git clone https://github.com/sgowda/plot $HOME/code/plotutil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this repo and the next one shouldn't be needed anymore

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should it be safe to just remove then?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i believe so

git clone https://github.com/sgowda/plot $HOME/code/plotutil
git clone https://github.com/sgowda/robotics_toolbox $HOME/code/robotics
# pygame
hg clone https://bitbucket.org/pygame/pygame $HOME/code/pygame
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this pip installable now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good catch! Pygame was already in requirements.txt, removed the redundant download here

@sgowda
Copy link
Contributor

sgowda commented May 20, 2019

This is cool, thanks for taking a stab at it! Docker install would be helpful and low risk since if you wanted you can always install it the hard way. I think it would be good to check (sometime closer to merge) that the config allows access to files outside of the container, like data files -- I have had some issues with that previously with Docker.

@TomekFraczek
Copy link
Collaborator Author

TomekFraczek commented May 20, 2019

Thanks! I'll keep an eye out for that issue.

Just to clarify though, do you mean to make sure that the docker image can write data files outside of the image?

@sgowda
Copy link
Contributor

sgowda commented May 21, 2019

the docker image should be able to both read and write files outside of the container. writing is needed for saving behavioral data generated during the experiment, reading is needed for analyses which need to open data files and reference task source code.

Base automatically changed from unstable_py3 to develop July 29, 2020 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants